package com.yuandian.management.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yuandian.api.management.entity.ConfIpDriftOnline;
import com.yuandian.bpm.common.core.util.R;
import com.yuandian.bpm.common.log.annotation.SysLog;
import com.yuandian.management.service.ConfIpDriftOnlineService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

import java.util.List;

/**
 * 漂移IP上线表-Controller
 * @author zfsn
 * @date 2023-3-15
 */
@Api(tags = "业务系统配置-IP漂移轨迹-确认IP")
@RestController
@RequestMapping("/ipDriftOnline")
public class ConfIpDriftOnlineController {

	@Autowired
	private ConfIpDriftOnlineService confIpDriftOnlineService;


	/**
	 * 通过主键查询数据
	 * @param idList 主键集合
	 * @return 通用返回对象
	 */
	@ApiOperation(value = "通过主键查询数据", notes = "通过主键查询数据，支持批量查询")
	@GetMapping("/{ids}")
	@ApiImplicitParams({
			@ApiImplicitParam(name = "ids", value = "id(可多选)", paramType = "query", required = true, dataTypeClass = Integer.class)
	})
	public R<List<ConfIpDriftOnline>> queryByIds(@PathVariable("ids") List<Integer> idList) {
		return R.ok(confIpDriftOnlineService.listByIds(idList));
	}

	/**
	 * 分页查询
	 *
	 * @param confIpDriftOnline 筛选条件
	 * @return 通用返回对象
	 */
	@ApiOperation(value = "分页查询", notes = "分页查询")
	@PostMapping
	@ApiImplicitParams({
			@ApiImplicitParam(name = "systemName", value = "系统名称", paramType = "body", required = false, dataType = "String"),
			@ApiImplicitParam(name = "componentIp", value = "组件IP", paramType = "body", required = false, dataTypeClass = Integer.class),
			@ApiImplicitParam(name = "oldSegmentName", value = "原所属网端名称", paramType = "body", required = false, dataType = "String"),
			@ApiImplicitParam(name = "newSegmentName", value = "新所属网端名称", paramType = "body", required = false, dataType = "String"),
			@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "body", required = false, dataType = "String"),
			@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "body", required = false, dataType = "String"),
			@ApiImplicitParam(name = "pageSize", value = "每页大小", paramType = "body", required = true, dataTypeClass = Integer.class),
			@ApiImplicitParam(name = "pageNum", value = "当前页数", paramType = "body", required = true, dataTypeClass = Integer.class),
	})
	public R<Page<ConfIpDriftOnline>> listPage(@RequestBody @ApiIgnore ConfIpDriftOnline confIpDriftOnline) {
		return  R.ok(confIpDriftOnlineService.listPage(confIpDriftOnline));
	}


	/**
	 * 通过主键删除数据
	 *
	 * @param ids 主键
	 * @return 通用返回对象
	 */
	@ApiOperation(value = "通过主键删除数据", notes = "通过主键删除数据")
	@SysLog("删除漂移IP上线表数据")
	@DeleteMapping("/delete/{ids}")
	public R<Boolean> removeByIds(@PathVariable("ids") List<Integer> ids) {
		return R.ok(confIpDriftOnlineService.removeByIds(ids));
	}
}
    